@echo off
cls
setlocal enabledelayedexpansion

SET DateStamp=%date:~6,4%%date:~3,2%%date:~0,2%
set "sourcedir=C:\Documents and Settings\rhythm divine\My Documents\Visual Studio 2010\Projects\BulkRenamer\OUTPUT\Installer"
set "destparent=C:\Documents and Settings\All Users\Documents\BulkRenamerInstaller"
set "destdir=%destparent%\%DateStamp%"
set "logname=file_list.log"

echo "%destdir%"
echo "%destdir%\%logname%"

IF EXIST "%destparent%\%logname%" del "%destparent%\%logname%"

echo DateStamp=%DateStamp% > "%destparent%\%logname%"
echo. >> "%destparent%\%logname%"

IF EXIST "%sourcedir%" goto R_Move
IF NOT EXIST "%sourcedir%" goto EOF


:R_Move
IF EXIST "%destdir%" echo Cleaning target.. >> "%destparent%\%logname%"
IF EXIST "%destdir%" rmdir /s /q "%destdir%" >> "%destparent%\%logname%"
REM IF EXIST "%destdir%" del /f /q "%destdir%\*.*"
echo. >> "%destparent%\%logname%"

IF NOT EXIST "%destdir%" echo Target not available.. >> "%destparent%\%logname%"
IF NOT EXIST "%destdir%" echo Creating target directory.. >> "%destparent%\%logname%"
IF NOT EXIST "%destdir%" mkdir "%destdir%"

echo Moving log file into target directory.. >> "%destparent%\%logname%"
move "%destparent%\%logname%" "%destdir%\%logname%"
echo. >> "%destdir%\%logname%"

echo Copying files.. >> "%destdir%\%logname%"
xcopy /y /e  "%sourcedir%" "%destdir%" >> "%destdir%\%logname%"
echo. >> "%destdir%\%logname%"

echo Opening target in Windows Explorer.. >> "%destdir%\%logname%"
explorer "%destdir%"
notepad "%destdir%\%logname%"
echo Exiting.. >> "%destdir%\%logname%"
echo. >> "%destdir%\%logname%"

goto EOF


:EOF
REM echo "$(ProjectDir)COPY_Installer.bat"
REM echo copy /y "$(SolutionDir)\OUTPUT\Installer\*.*" "C:\Documents and Settings\All Users\Documents\BulkRenamerInstaller\"%date:~6,4%%date:~3,2%%date:~0,2%"\*.*"
